package com.seanLab.tool;


import com.seanLab.domain.TagInfo;
import com.seanLab.dto.RecommendArticleDto;
import com.seanLab.dto.SuggestArticleKeywordsDto;
import com.seanLab.dto.SuggestModelArticleDto;
import com.seanLab.tool.TagSuggestModel.TagSuggestModel;
import com.seanLab.tool.TagSuggestModel.TagSuggestModelByER;

import java.util.List;

public class TagSuggestor implements TagSuggest{
    TagSuggestModel tagSuggestModel;

    public TagSuggestor() {
        tagSuggestModel = new TagSuggestModelByER();
    }

    public List<List<TagInfo>> doTag(SuggestModelArticleDto article) {
        return tagSuggestModel.suggestTagOfImagedArticle(article, article.getSuggestModelImageDtoList());
    }

    @Override
    public List<SuggestArticleKeywordsDto> doKeyword(SuggestModelArticleDto article) {
        return tagSuggestModel.suggestTagOfArticle(new RecommendArticleDto(article.getTitle(), article.getContent(), null));
    }

    public List<SuggestArticleKeywordsDto> doSuggest(RecommendArticleDto article) {
        return tagSuggestModel.suggestTagOfArticle(article);
    }

    public String train(List<SuggestModelArticleDto> dataset) {
        return tagSuggestModel.trainModel(dataset);
    }

    public boolean loadModel(String modelPath) {
        return tagSuggestModel.loadModel(modelPath);
    }

}
